import axios from "@/request/request.js";
import qs from "qs"


// 获取精品推荐数据
export const JingpinAPI = () => axios.get("/products/recommend");


// 获取热门推荐数据
export const RenmenAPI = () => axios.get("/products/hot");

export const sandSMSAPI = (params) => axios.post("/sendSMS", qs.stringify(params));

// 清理请求
export const PhoneReginAPI = (params) => axios.post("/phoneRegin", qs.stringify(params));

// 微信扫码登录
export const weixinLoginAPI = (params) => axios.post("/wechatUsers/PCLogin", qs.stringify(params));

// 微信扫码登录
export const weixinJiebangAPI = (params) => axios.post("/wechatUsers/unbindingWeChat", qs.stringify(params));

// 手机号码绑定微信
export const BindingAPI = (params) => axios.post("/wechatUsers/binding", qs.stringify(params));

// 用户信息
export const userProfilesAPI = () => axios.get("/shop/userProfiles");

// 商品详情页
export const GoosDetailsAPI = (id) => axios.get(`/products/${id}`);

// 
// 加入购物车
export const AddToCatrgAPI = (params) => axios.post("/shop/carts/add", qs.stringify(params));

// 
// 商品搜索 [请求体] axios.get(url,{params:''})
// params={did:1,type:xx,min:1...}
export const GoosSearchAPI = (params) => axios.get("/products", { params });//params:params


// 查看购物车  
export const ShopCartAPI = () => axios.get("/shop/carts");

// 删除购物车  /shop/carts?productIds={id} 
export const DelCartAPI = (id) => axios.delete(`/shop/carts?productIds=${id}`);

// 解绑微信 /wechatUsers/unbindingWeChat
export const unbindWeChatAPI = () => axios.put("/wechatUsers/unbindingWeChat");